package main

import "fmt"

func main() {
	var numbers = make([]int, 3, 5)

	printSlice(numbers)
	numbers = []int{1, 2, 3, 4, 5, 6, 7, 8, 9}
	printSlice(numbers)
	//2,3,4
	fmt.Println(numbers[1:4])
	//1,2,3
	fmt.Println(numbers[:3])
	//5,6,7,8,9
	fmt.Println(numbers[4:])
	printSlice(numbers[1:4])
	printSlice(numbers[:3])

	numbers = append(numbers, 10)
	printSlice(numbers)
	numbers1 := make([]int, len(numbers), cap(numbers)*2)
	copy(numbers1, numbers)
	printSlice(numbers1)
}
func printSlice(x []int) {
	fmt.Printf("len=%d cap=%d slice=%v\n", len(x), cap(x), x)
}
